import React, { useEffect, useState, } from 'react';
import { LeftOutlined } from '@ant-design/icons';
import { getUser2Djm, putUserDjm } from '../../api/api';
import { TreeSelect,Cascader  } from 'antd';
import json from './json.json'

export default function Dizhi() {
  const [value, setValue] = useState();
  const id = sessionStorage.getItem('id')
  return (
    <div>
      <header style={{display:'flex',alignItems: 'center',justifyContent: 'space-between',padding:'0 10px',height:'50px'}}>
        <LeftOutlined onClick={()=>{
          window.history.back()
        }}/>
        <h3>收货地址</h3>
        <div style={{color:'#e98f36'}} onClick={()=>{
          putUserDjm({shou:value,id:id}).then(res=>console.log(res))
          window.history.back()
        }}>保存</div>
      </header>
      <Cascader style={{width:'70%'}} options={json} onChange={(e)=>{
        console.log(e);
         setValue(e.toString());
      }} placeholder="请选择收货地址" />
    </div>
  )
}
